﻿using System;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Metadata;

namespace BCC.Model
{
    public partial class bccContext : DbContext
    {
        public bccContext()
        {
        }

        public bccContext(DbContextOptions<bccContext> options)
            : base(options)
        {
        }

        public virtual DbSet<UChatinfo> UChatinfo { get; set; }
        public virtual DbSet<UUser> UUser { get; set; }

        protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder)
        {
            if (!optionsBuilder.IsConfigured)
            {
#warning To protect potentially sensitive information in your connection string, you should move it out of source code. See http://go.microsoft.com/fwlink/?LinkId=723263 for guidance on storing connection strings.
                optionsBuilder.UseMySql("server=localhost;port=3306;database=bcc;uid=root;pwd=123456;charset=utf8", x => x.ServerVersion("8.0.28-mysql"));
            }
        }

        protected override void OnModelCreating(ModelBuilder modelBuilder)
        {
            modelBuilder.Entity<UChatinfo>(entity =>
            {
                entity.ToTable("u_chatinfo");

                entity.Property(e => e.CreateTime)
                    .IsRequired()
                    .HasColumnType("datetime")
                    .HasComment("创建时间")
                    .HasCharSet("utf8mb4")
                    .HasCollation("utf8mb4_0900_ai_ci");

                entity.Property(e => e.Info)
                    .IsRequired()
                    .HasColumnType("varchar(255)")
                    .HasComment("信息")
                    .HasCharSet("utf8mb4")
                    .HasCollation("utf8mb4_0900_ai_ci");

                entity.Property(e => e.IsDelete).HasComment("是否删除1是0否");

                entity.Property(e => e.ReceiveAccount)
                    .IsRequired()
                    .HasColumnType("varchar(50)")
                    .HasComment("接收人账号")
                    .HasCharSet("utf8mb4")
                    .HasCollation("utf8mb4_0900_ai_ci");

                entity.Property(e => e.SendAccount)
                    .IsRequired()
                    .HasColumnType("varchar(50)")
                    .HasComment("发送人账号")
                    .HasCharSet("utf8mb4")
                    .HasCollation("utf8mb4_0900_ai_ci");
            });

            modelBuilder.Entity<UUser>(entity =>
            {
                entity.ToTable("u_user");

                entity.Property(e => e.Account)
                    .IsRequired()
                    .HasColumnType("varchar(50)")
                    .HasComment("账号")
                    .HasCharSet("utf8mb4")
                    .HasCollation("utf8mb4_0900_ai_ci");

                entity.Property(e => e.Address)
                    .HasColumnType("varchar(255)")
                    .HasComment("地址")
                    .HasCharSet("utf8mb4")
                    .HasCollation("utf8mb4_0900_ai_ci");

                entity.Property(e => e.CreateTime)
                    .HasColumnType("datetime")
                    .HasComment("创建时间");

                entity.Property(e => e.Creater)
                    .HasColumnType("varchar(255)")
                    .HasComment("创建人")
                    .HasCharSet("utf8mb4")
                    .HasCollation("utf8mb4_0900_ai_ci");

                entity.Property(e => e.IsDelete).HasComment("是否删除1是0否");

                entity.Property(e => e.Mail)
                    .HasColumnType("varchar(255)")
                    .HasComment("邮箱")
                    .HasCharSet("utf8mb4")
                    .HasCollation("utf8mb4_0900_ai_ci");

                entity.Property(e => e.Password)
                    .IsRequired()
                    .HasColumnType("varchar(50)")
                    .HasComment("密码")
                    .HasCharSet("utf8mb4")
                    .HasCollation("utf8mb4_0900_ai_ci");

                entity.Property(e => e.RoleId).HasComment("角色");

                entity.Property(e => e.Telephone)
                    .HasColumnType("varchar(50)")
                    .HasComment("电话")
                    .HasCharSet("utf8mb4")
                    .HasCollation("utf8mb4_0900_ai_ci");

                entity.Property(e => e.UpdateTime)
                    .HasColumnType("datetime")
                    .HasComment("修改时间");

                entity.Property(e => e.UserName)
                    .IsRequired()
                    .HasColumnType("varchar(30)")
                    .HasComment("名称")
                    .HasCharSet("utf8mb4")
                    .HasCollation("utf8mb4_0900_ai_ci");

                entity.Property(e => e.UserSign)
                    .HasColumnType("varchar(100)")
                    .HasComment("签名")
                    .HasCharSet("utf8mb4")
                    .HasCollation("utf8mb4_0900_ai_ci");
            });

            OnModelCreatingPartial(modelBuilder);
        }

        partial void OnModelCreatingPartial(ModelBuilder modelBuilder);
    }
}
